package com.bana.fvs.app.mvp.presenter;

import android.app.Activity;

import com.bana.fvs.app.main.entity.FogZoneListItemBean;
import com.bana.fvs.app.mvp.contract.FogZoneContract;
import com.bana.fvs.app.mvp.model.FogZoneModel;
import com.wei.commonlibrary.net.CommException;
import com.wei.commonlibrary.net.MyDefaultCallback;

import java.util.List;

/**
 * Author : yanftch
 * Date : 2018/3/2
 * Time : 22:19
 * Desc :
 */

public class FogZonePresenter extends FogZoneContract.AbsFogZonePresnter {

    @Override
    public void http_getFogList(Activity activity, String token) {
        mModel.http_getFogList(activity, token).callback(new MyDefaultCallback<List<FogZoneListItemBean>>(activity, true) {
            @Override
            public void onError(CommException e) {
                if (null != getView())
                    getView().onError(e);
            }

            @Override
            public void response(List<FogZoneListItemBean> fogZoneListItemBeans) {
                if (null != getView())
                    getView().onResponse(fogZoneListItemBeans);
            }
        });
    }

    @Override
    protected FogZoneContract.AbsFogZoneModel createModel() {
        return new FogZoneModel();
    }
}
